package com.atguigu.gmallpublisher.service.impl;

import com.atguigu.gmallpublisher.mapper.GmvMapper;
import com.atguigu.gmallpublisher.mapper.UvMapper;
import com.atguigu.gmallpublisher.service.UvService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @className: UvServiceImpl
 * @author: LinCong
 * @description:
 * @date: 2023/2/19 11:09
 * @version: 1.0
 */
@Service
public class UvServiceImpl implements UvService {
    @Autowired
    private UvMapper uvMapper;

    @Override
    public Map getUvByCh(int date) {
        HashMap<String, BigInteger> resultMap = new HashMap<>();
        List<Map> mapList = uvMapper.selectUvByCh(date);
        for (Map map : mapList) {
            resultMap.put((String) map.get("ch"),(BigInteger) map.get("uv"));
        }

        return resultMap;
    }
}
